<template>
    <a-select :value="modelValue" :options="options" placeholder="请选择职位" :field-names="{ label: 'title', value: 'id' }" @change="handleChange" />
</template>

<script setup lang="ts">
import { getPositionList } from '@/api/system/organize/position'
const props = defineProps<{
    modelValue: string | number
}>()

const emit = defineEmits(['update:modelValue'])

const options = ref([])

onMounted(async () => {
    const res = await getPositionList()
    options.value = res.lists
})

const handleChange = (value: string | number | null) => {
    emit('update:modelValue', value || '')
}

</script>
